﻿package core.ui.controls
{
    import core.event.*;
    import flash.display.*;
    import flash.geom.*;

    public class GradientPad extends Sprite
    {
        public var nr:int;
        private var thumb:Sprite;
        private var mtx:Matrix;
        public var colors:Array;
        public var alphas:Array;
        public var ratios:Array;

        public function GradientPad(param1:Array, param2:Array, param3:Array)
        {
            this.graphics.beginFill(9474192);
            this.graphics.drawRect(0, 0, 100, 20);
            this.graphics.beginFill(16777215);
            this.graphics.drawRect(1, 1, 98, 18);
            this.graphics.beginBitmapFill(new Transparent());
            this.graphics.drawRect(2, 2, 96, 16);
            this.graphics.endFill();
            this.mtx = new Matrix();
            this.mtx.createGradientBox(96, 16, 0, 0, 0);
            this.thumb = new Sprite();
            this.thumb.x = 2;
            this.thumb.y = 2;
            addChild(this.thumb);
            this.Reset(param1, param2, param3);
            return;
        }// end function

        public function Reset(colors:Array, colors:Array, colors:Array) : void
        {
            this.colors = colors;
            this.alphas = colors;
            this.ratios = colors;
            this.thumb.graphics.clear();
            this.thumb.graphics.beginGradientFill(GradientType.LINEAR, colors, colors, colors, this.mtx);
            this.thumb.graphics.drawRect(0, 0, 96, 16);
            this.thumb.graphics.endFill();
            dispatchEvent(new ChangeEvent("cng"));
            return;
        }// end function

    }
}
